package com.appwoo.txtws.activity;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.TranslateAnimation;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.appwoo.txtws.adapter.SyncTutorialAdapter;
import com.appwoo.txtws.bean.BookBean;
import com.appwoo.txtws.bean.BookGradeBean;
import com.appwoo.txtws.bean.BookSubjectBean;
import com.appwoo.txtws.component.BookHelper;
import com.appwoo.txtws.component.DBHelper;
import com.appwoo.txtws.component.Global;
import com.appwoo.txtws.wheel.widget.PageListView;
import com.appwoo.txtws.wheel.widget.PageListView.OnRefreshListener;
import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;

public class SyncTutorialActivity extends BookActivity
  implements AbsListView.OnScrollListener, View.OnClickListener
{
  public static final String BOOKSTORE_LEVEL_TYPE = "synctutorial";
  public static final String SP_KEY_BOOK = "book";
  public static final String SP_KEY_BOOK_SUBJECT_SYNC_TUTORIAL = "bookSubjectSynctutorial";
  public static final String STORAGESIZE_MEMORY = "memory";
  public static final String STORAGESIZE_NOT = "not";
  public static final String STORAGESIZE_SDCARD = "sdcard";
  public static ArrayList<AsyncTask<String, Integer, String>> downloadTask;
  private int animTime = 500;
  private Dialog bookConfirmDialog;
  private Dialog bookDialog;
  private boolean bookStoreMenuOut;
  private ArrayList<BookSubjectBean> bookSubjects;
  private int bookType = 0;
  private View.OnClickListener confirmDialogNoOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      SyncTutorialActivity.this.bookConfirmDialog.dismiss();
    }
  };
  private View.OnClickListener confirmDialogYesOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      BookBean localBookBean = (BookBean)paramAnonymousView.getTag();
      String str = localBookBean.getLocalPath();
      SyncTutorialActivity.this.mDBHelper.removeBookBeanByBookId(localBookBean.getBookId());
      BookSubjectBean localBookSubjectBean = SyncTutorialActivity.this.mDBHelper.getBookSubjectBySubjectId(localBookBean.getSubjectId());
      SyncTutorialActivity.this.listSyncTutorialBookBean = SyncTutorialActivity.this.mDBHelper.getBookBeanListBySubjectId(SyncTutorialActivity.this.currentBookSubjectBean.getSubjectId(), 0);
      if (((SyncTutorialActivity.this.listSyncTutorialBookBean == null) || (SyncTutorialActivity.this.listSyncTutorialBookBean.isEmpty())) && (localBookSubjectBean != null) && (localBookSubjectBean.getDeleteable() == 1) && (localBookSubjectBean.getAscription() != null) && (localBookSubjectBean.getAscription().indexOf("@0@") > -1))
      {
        localBookSubjectBean.setAscription(localBookSubjectBean.getAscription().replace("@0@", ""));
        SyncTutorialActivity.this.mDBHelper.updateBookSubjectBean(localBookSubjectBean);
      }
      SyncTutorialActivity.this.mBookHelper.deleteAllFile(new File(str));
      SyncTutorialActivity.this.loadBookSubjectData();
      SyncTutorialActivity.this.bookConfirmDialog.dismiss();
    }
  };
  private BookSubjectBean currentBookSubjectBean;
  private View.OnClickListener dialogCloseOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      SyncTutorialActivity.this.bookDialog.dismiss();
    }
  };
  private View.OnClickListener dialogRemoveOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      BookBean localBookBean = (BookBean)paramAnonymousView.getTag();
      SyncTutorialActivity.this.showConfirmRemoveDialog(localBookBean);
    }
  };
  private View.OnClickListener dialogViewOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      BookBean localBookBean = (BookBean)paramAnonymousView.getTag();
      Intent localIntent = new Intent(SyncTutorialActivity.this, BookReaderQuestionActivity.class);
      localIntent.putExtra("bookname", localBookBean.getName());
      localIntent.putExtra("readerType", "local");
      SyncTutorialActivity.this.startActivity(localIntent);
      SyncTutorialActivity.this.bookDialog.dismiss();
    }
  };
  private DisplayMetrics dm;
  private Dialog exitConfirmClickDialog;
  private View.OnClickListener exitConfirmDialogNoOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      SyncTutorialActivity.this.exitConfirmClickDialog.dismiss();
    }
  };
  private View.OnClickListener exitConfirmDialogYesOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      SyncTutorialActivity.this.exitConfirmClickDialog.dismiss();
      SyncTutorialActivity.this.finish();
    }
  };
  private int firstExtra;
  private LayoutInflater inflater;
  private int listItemHeight;
  private ArrayList<BookBean> listSyncTutorialBookBean;
  private SyncTutorialAdapter mAdapter;
  private BookHelper mBookHelper;
  private DBHelper mDBHelper;
  private LinearLayout mLayoutSyncTutorialBookStore;
  private LinearLayout mLayoutSyncTutorialBookStoreOut;
  private RelativeLayout mLayoutSyncTutorialHeader;
  private LinearLayout mLayoutSyncTutorialSubject;
  private PageListView mLvSyncTutorialMain;
  private ScrollView mSvSynvTutorialSubject;
  private ImageView mTxtHeaderBookStore;
  private TextView mTxtHeaderSubject;
  private View.OnClickListener onGradeClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      int i = Integer.valueOf(paramAnonymousView.getTag().toString()).intValue();
      SyncTutorialActivity.this.hiddenBookStoreGradeMenu();
      Intent localIntent = new Intent(SyncTutorialActivity.this, BookstoreActivity.class);
      localIntent.putExtra("subject", SyncTutorialActivity.this.currentBookSubjectBean.getName());
      localIntent.putExtra("bookType", SyncTutorialActivity.this.bookType);
      localIntent.putExtra("grade", i);
      SyncTutorialActivity.this.startActivity(localIntent);
    }
  };
  private View.OnClickListener onSubjectMenuClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      BookSubjectBean localBookSubjectBean = (BookSubjectBean)paramAnonymousView.getTag();
      if (localBookSubjectBean != null)
      {
        SyncTutorialActivity.this.currentBookSubjectBean = localBookSubjectBean;
        SyncTutorialActivity.this.loadBookSubjectData();
      }
    }
  };
  private String[] strs = { "幼儿园", "小学", "初中", "高中" };
  private boolean subjectMenuOut;

  private void drawSubjectMenu()
  {
    int i;
    Iterator localIterator;
    if ((this.bookSubjects != null) && (!this.bookSubjects.isEmpty()))
    {
      this.mLayoutSyncTutorialSubject.removeAllViews();
      if (this.currentBookSubjectBean == null)
        this.currentBookSubjectBean = ((BookSubjectBean)this.bookSubjects.get(0));
      i = 0;
      localIterator = this.bookSubjects.iterator();
    }
    while (true)
    {
      if (!localIterator.hasNext())
      {
        if (i == 0)
          this.currentBookSubjectBean = ((BookSubjectBean)this.bookSubjects.get(0));
        return;
      }
      BookSubjectBean localBookSubjectBean = (BookSubjectBean)localIterator.next();
      if (this.currentBookSubjectBean.getName().equals(localBookSubjectBean.getName()))
        i = 1;
      View localView = this.inflater.inflate(2130903211, null);
      ((TextView)localView.findViewById(2131493551)).setText(localBookSubjectBean.getName());
      ((TextView)localView.findViewById(2131493552)).setText(String.valueOf(localBookSubjectBean.getBookCount()));
      localView.setOnClickListener(this.onSubjectMenuClickListener);
      localView.setTag(localBookSubjectBean);
      if (localBookSubjectBean.getName().equals(this.currentBookSubjectBean.getName()))
        localView.setBackgroundColor(getResources().getColor(2131230809));
      this.mLayoutSyncTutorialSubject.addView(localView);
    }
  }

  private String enoughStorageSize()
  {
    if ((Global.isSDCard()) && (Global.getSDCardSize(this) >= 30))
      return "sdcard";
    if (Global.getMemorySize() >= 30)
      return "memory";
    return "not";
  }

  private void findViews()
  {
    this.mLvSyncTutorialMain = ((PageListView)findViewById(2131492985));
    this.mTxtHeaderSubject = ((TextView)findViewById(2131493533));
    this.mTxtHeaderBookStore = ((ImageView)findViewById(2131493534));
    this.mLayoutSyncTutorialSubject = ((LinearLayout)findViewById(2131493536));
    this.mSvSynvTutorialSubject = ((ScrollView)findViewById(2131493535));
    this.mLayoutSyncTutorialBookStoreOut = ((LinearLayout)findViewById(2131493537));
    this.mLayoutSyncTutorialBookStore = ((LinearLayout)findViewById(2131493538));
    this.mLayoutSyncTutorialHeader = ((RelativeLayout)findViewById(2131493532));
    downloadTask = new ArrayList();
    this.dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(this.dm);
    this.inflater = ((LayoutInflater)getSystemService("layout_inflater"));
    this.mDBHelper = new DBHelper(this);
    this.mBookHelper = new BookHelper();
  }

  public static ArrayList<BookSubjectBean> getInitBookSubjectBeanList()
  {
    ArrayList localArrayList = new ArrayList();
    BookSubjectBean localBookSubjectBean1 = new BookSubjectBean();
    localBookSubjectBean1.setName("语文");
    localBookSubjectBean1.setDrawable("book_subject_yw");
    localBookSubjectBean1.setDeleteable(0);
    localArrayList.add(localBookSubjectBean1);
    BookSubjectBean localBookSubjectBean2 = new BookSubjectBean();
    localBookSubjectBean2.setName("数学");
    localBookSubjectBean2.setDrawable("book_subject_sx");
    localBookSubjectBean2.setDeleteable(0);
    localArrayList.add(localBookSubjectBean2);
    BookSubjectBean localBookSubjectBean3 = new BookSubjectBean();
    localBookSubjectBean3.setName("英语");
    localBookSubjectBean3.setDrawable("book_subject_yy");
    localBookSubjectBean3.setDeleteable(0);
    localArrayList.add(localBookSubjectBean3);
    BookSubjectBean localBookSubjectBean4 = new BookSubjectBean();
    localBookSubjectBean4.setName("政治");
    localBookSubjectBean4.setDrawable("book_subject_zz");
    localBookSubjectBean4.setDeleteable(1);
    localArrayList.add(localBookSubjectBean4);
    BookSubjectBean localBookSubjectBean5 = new BookSubjectBean();
    localBookSubjectBean5.setName("地理");
    localBookSubjectBean5.setDrawable("book_subject_dl");
    localBookSubjectBean5.setDeleteable(1);
    localArrayList.add(localBookSubjectBean5);
    BookSubjectBean localBookSubjectBean6 = new BookSubjectBean();
    localBookSubjectBean6.setName("历史");
    localBookSubjectBean6.setDrawable("book_subject_ls");
    localBookSubjectBean6.setDeleteable(1);
    localArrayList.add(localBookSubjectBean6);
    BookSubjectBean localBookSubjectBean7 = new BookSubjectBean();
    localBookSubjectBean7.setName("物理");
    localBookSubjectBean7.setDrawable("book_subject_wl");
    localBookSubjectBean7.setDeleteable(1);
    localArrayList.add(localBookSubjectBean7);
    BookSubjectBean localBookSubjectBean8 = new BookSubjectBean();
    localBookSubjectBean8.setName("化学");
    localBookSubjectBean8.setDrawable("book_subject_hx");
    localBookSubjectBean8.setDeleteable(1);
    localArrayList.add(localBookSubjectBean8);
    BookSubjectBean localBookSubjectBean9 = new BookSubjectBean();
    localBookSubjectBean9.setName("生物");
    localBookSubjectBean9.setDrawable("book_subject_sw");
    localBookSubjectBean9.setDeleteable(1);
    localArrayList.add(localBookSubjectBean9);
    BookSubjectBean localBookSubjectBean10 = new BookSubjectBean();
    localBookSubjectBean10.setName("其他");
    localBookSubjectBean10.setDrawable("book_subject_qt");
    localBookSubjectBean10.setDeleteable(1);
    localArrayList.add(localBookSubjectBean10);
    return localArrayList;
  }

  private void getListItemHeight()
  {
    this.dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(this.dm);
    int i = this.mLayoutSyncTutorialHeader.getHeight();
    int j = getStatusHeight(this);
    int k = this.dm.heightPixels - i - j;
    this.listItemHeight = (k / 5);
    this.firstExtra = (k % 5);
  }

  public static int getStatusHeight(Context paramContext)
  {
    try
    {
      Class localClass = Class.forName("com.android.internal.R$dimen");
      Object localObject = localClass.newInstance();
      int i = Integer.parseInt(localClass.getField("status_bar_height").get(localObject).toString());
      int j = paramContext.getResources().getDimensionPixelSize(i);
      return j;
    }
    catch (NumberFormatException localNumberFormatException)
    {
      localNumberFormatException.printStackTrace();
      return 0;
    }
    catch (SecurityException localSecurityException)
    {
      while (true)
        localSecurityException.printStackTrace();
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      while (true)
        localIllegalArgumentException.printStackTrace();
    }
    catch (Resources.NotFoundException localNotFoundException)
    {
      while (true)
        localNotFoundException.printStackTrace();
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      while (true)
        localClassNotFoundException.printStackTrace();
    }
    catch (IllegalAccessException localIllegalAccessException)
    {
      while (true)
        localIllegalAccessException.printStackTrace();
    }
    catch (InstantiationException localInstantiationException)
    {
      while (true)
        localInstantiationException.printStackTrace();
    }
    catch (NoSuchFieldException localNoSuchFieldException)
    {
      while (true)
        localNoSuchFieldException.printStackTrace();
    }
  }

  private void hiddenBookStoreGradeMenu()
  {
    if (this.bookStoreMenuOut)
    {
      this.bookStoreMenuOut = false;
      TranslateAnimation localTranslateAnimation = new TranslateAnimation(0.0F, 0.0F, 0.0F, -this.mLayoutSyncTutorialBookStoreOut.getMeasuredHeight());
      localTranslateAnimation.setDuration(this.animTime);
      localTranslateAnimation.setAnimationListener(new Animation.AnimationListener()
      {
        public void onAnimationEnd(Animation paramAnonymousAnimation)
        {
          SyncTutorialActivity.this.mLayoutSyncTutorialBookStoreOut.setVisibility(8);
          SyncTutorialActivity.this.mTxtHeaderBookStore.setOnClickListener(SyncTutorialActivity.this);
        }

        public void onAnimationRepeat(Animation paramAnonymousAnimation)
        {
        }

        public void onAnimationStart(Animation paramAnonymousAnimation)
        {
          SyncTutorialActivity.this.mTxtHeaderBookStore.setOnClickListener(null);
        }
      });
      this.mLayoutSyncTutorialBookStoreOut.startAnimation(localTranslateAnimation);
    }
  }

  public static void initBookSubjectBeanList(Context paramContext, DBHelper paramDBHelper)
  {
    Iterator localIterator = getInitBookSubjectBeanList().iterator();
    while (true)
    {
      if (!localIterator.hasNext())
      {
        writeBookGrade(paramContext, paramDBHelper);
        return;
      }
      paramDBHelper.updateBookSubjectBean((BookSubjectBean)localIterator.next());
    }
  }

  private void initSubjectMenuData()
  {
    this.bookSubjects = new ArrayList();
    this.bookSubjects = this.mDBHelper.getBookSubjectBeanList(this.bookType);
    int i = 0;
    Iterator localIterator = this.bookSubjects.iterator();
    while (true)
    {
      if (!localIterator.hasNext())
      {
        BookSubjectBean localBookSubjectBean = new BookSubjectBean();
        localBookSubjectBean.setSubjectId(-1);
        localBookSubjectBean.setName("全部");
        localBookSubjectBean.setBookCount(i);
        this.bookSubjects.add(0, localBookSubjectBean);
        return;
      }
      i += ((BookSubjectBean)localIterator.next()).getBookCount();
    }
  }

  private void loadBookListData()
  {
    new LoadBookListTask().execute(new String[0]);
  }

  private void loadBookSubjectData()
  {
    new LoadBookSubjectTask().execute(new String[0]);
  }

  private void setViews()
  {
    this.mTxtHeaderSubject.setOnClickListener(this);
    this.mTxtHeaderBookStore.setOnClickListener(this);
    for (int i = 0; ; i++)
    {
      if (i >= this.strs.length)
      {
        this.listSyncTutorialBookBean = new ArrayList();
        this.mLayoutSyncTutorialHeader.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
        {
          public void onGlobalLayout()
          {
            if (SyncTutorialActivity.this.mAdapter == null)
            {
              SyncTutorialActivity.this.getListItemHeight();
              SyncTutorialActivity.this.mAdapter = new SyncTutorialAdapter(SyncTutorialActivity.this, SyncTutorialActivity.this.listSyncTutorialBookBean, SyncTutorialActivity.this.dm, SyncTutorialActivity.this.enoughStorageSize(), SyncTutorialActivity.this.listItemHeight, SyncTutorialActivity.this.firstExtra);
              SyncTutorialActivity.this.mLvSyncTutorialMain.setAdapter(SyncTutorialActivity.this.mAdapter);
              SyncTutorialActivity.this.mLvSyncTutorialMain.hideFotterMoreView();
            }
          }
        });
        this.mLvSyncTutorialMain.setOnScrollListener(this);
        this.mLvSyncTutorialMain.setOnLoadMoreListener(new PageListView.OnRefreshListener()
        {
          public void onRefresh()
          {
          }
        });
        return;
      }
      View localView = this.inflater.inflate(2130903057, null);
      ((TextView)localView.findViewById(2131492967)).setText(this.strs[i]);
      localView.setTag(Integer.valueOf(i));
      localView.setOnClickListener(this.onGradeClickListener);
      this.mLayoutSyncTutorialBookStore.addView(localView);
    }
  }

  private void showBookStoreGradeMenu()
  {
    if (!this.bookStoreMenuOut)
    {
      this.bookStoreMenuOut = true;
      TranslateAnimation localTranslateAnimation = new TranslateAnimation(0.0F, 0.0F, -this.mLayoutSyncTutorialBookStoreOut.getMeasuredHeight(), 0.0F);
      localTranslateAnimation.setDuration(this.animTime);
      localTranslateAnimation.setAnimationListener(new Animation.AnimationListener()
      {
        public void onAnimationEnd(Animation paramAnonymousAnimation)
        {
          SyncTutorialActivity.this.mTxtHeaderBookStore.setOnClickListener(SyncTutorialActivity.this);
        }

        public void onAnimationRepeat(Animation paramAnonymousAnimation)
        {
        }

        public void onAnimationStart(Animation paramAnonymousAnimation)
        {
          SyncTutorialActivity.this.mTxtHeaderBookStore.setOnClickListener(null);
        }
      });
      this.mLayoutSyncTutorialBookStoreOut.setVisibility(0);
      this.mLayoutSyncTutorialBookStoreOut.startAnimation(localTranslateAnimation);
    }
  }

  private void showSubjectMenu()
  {
    if (!this.subjectMenuOut)
    {
      this.subjectMenuOut = true;
      this.mTxtHeaderSubject.setCompoundDrawablesWithIntrinsicBounds(0, 0, 2130837991, 0);
      TranslateAnimation localTranslateAnimation = new TranslateAnimation(0.0F, 0.0F, -this.mSvSynvTutorialSubject.getMeasuredHeight(), 0.0F);
      localTranslateAnimation.setDuration(this.animTime);
      localTranslateAnimation.setAnimationListener(new Animation.AnimationListener()
      {
        public void onAnimationEnd(Animation paramAnonymousAnimation)
        {
          SyncTutorialActivity.this.mTxtHeaderSubject.setOnClickListener(SyncTutorialActivity.this);
        }

        public void onAnimationRepeat(Animation paramAnonymousAnimation)
        {
        }

        public void onAnimationStart(Animation paramAnonymousAnimation)
        {
          SyncTutorialActivity.this.mTxtHeaderSubject.setOnClickListener(null);
        }
      });
      this.mSvSynvTutorialSubject.setVisibility(0);
      this.mSvSynvTutorialSubject.startAnimation(localTranslateAnimation);
    }
  }

  private static void writeBookGrade(Context paramContext, DBHelper paramDBHelper)
  {
    writeBookStoreLevelOperate(paramContext.getResources().getStringArray(2131165204), 0, paramDBHelper);
    writeBookStoreLevelOperate(paramContext.getResources().getStringArray(2131165205), 1, paramDBHelper);
    writeBookStoreLevelOperate(paramContext.getResources().getStringArray(2131165206), 2, paramDBHelper);
    writeBookStoreLevelOperate(paramContext.getResources().getStringArray(2131165207), 3, paramDBHelper);
    writeBookStoreLevelOperate(new String[] { "中考", "高考" }, 4, paramDBHelper);
  }

  private static void writeBookStoreLevelOperate(String[] paramArrayOfString, int paramInt, DBHelper paramDBHelper)
  {
    int i = paramArrayOfString.length;
    for (int j = 0; ; j++)
    {
      if (j >= i)
        return;
      String str = paramArrayOfString[j];
      BookGradeBean localBookGradeBean = new BookGradeBean();
      localBookGradeBean.setGradeName(str);
      localBookGradeBean.setParent(paramInt);
      paramDBHelper.updateBookGradeBean(localBookGradeBean);
    }
  }

  private void writeData()
  {
    SharedPreferences localSharedPreferences = getSharedPreferences("book", 0);
    String str1 = localSharedPreferences.getString("bookSubjectSynctutorial", null);
    String[] arrayOfString;
    Iterator localIterator;
    if ((str1 == null) || ("".equals(str1)))
    {
      arrayOfString = new String[] { "语文", "数学", "英语" };
      localIterator = this.mDBHelper.getBookSubjectBeanList(-1).iterator();
      if (!localIterator.hasNext())
      {
        SharedPreferences.Editor localEditor = localSharedPreferences.edit();
        localEditor.putString("bookSubjectSynctutorial", "writed");
        localEditor.commit();
      }
    }
    else
    {
      return;
    }
    BookSubjectBean localBookSubjectBean = (BookSubjectBean)localIterator.next();
    int i = arrayOfString.length;
    int j = 0;
    label127: if (j < i)
      if (arrayOfString[j].equals(localBookSubjectBean.getName()))
      {
        String str2 = localBookSubjectBean.getAscription();
        if ((str2 == null) || ("".equals(str2)))
          break label236;
        if (str2.indexOf("@0@") == -1)
          localBookSubjectBean.setAscription(str2 + "@" + 0 + "@");
      }
    while (true)
    {
      this.mDBHelper.updateBookSubjectBean(localBookSubjectBean);
      j++;
      break label127;
      break;
      label236: localBookSubjectBean.setAscription("@0@");
    }
  }

  protected void backKeyCallBack()
  {
    super.backKeyCallBack();
    if (this.subjectMenuOut)
    {
      hiddenSubjectMenu();
      return;
    }
    if (this.bookStoreMenuOut)
    {
      hiddenBookStoreGradeMenu();
      return;
    }
    if ((BookstoreActivity.downloadTasks != null) && (!BookstoreActivity.downloadTasks.isEmpty()))
    {
      showExitClickDialog();
      return;
    }
    finish();
  }

  public void hiddenSubjectMenu()
  {
    if (this.subjectMenuOut)
    {
      this.subjectMenuOut = false;
      this.mTxtHeaderSubject.setCompoundDrawablesWithIntrinsicBounds(0, 0, 2130837990, 0);
      TranslateAnimation localTranslateAnimation = new TranslateAnimation(0.0F, 0.0F, 0.0F, -this.mSvSynvTutorialSubject.getMeasuredHeight());
      localTranslateAnimation.setDuration(this.animTime);
      localTranslateAnimation.setAnimationListener(new Animation.AnimationListener()
      {
        public void onAnimationEnd(Animation paramAnonymousAnimation)
        {
          SyncTutorialActivity.this.mSvSynvTutorialSubject.setVisibility(8);
          SyncTutorialActivity.this.mTxtHeaderSubject.setOnClickListener(SyncTutorialActivity.this);
        }

        public void onAnimationRepeat(Animation paramAnonymousAnimation)
        {
        }

        public void onAnimationStart(Animation paramAnonymousAnimation)
        {
          SyncTutorialActivity.this.mTxtHeaderSubject.setOnClickListener(null);
        }
      });
      this.mSvSynvTutorialSubject.startAnimation(localTranslateAnimation);
    }
  }

  public boolean isSubjectMenuOut()
  {
    return this.subjectMenuOut;
  }

  public void onClick(View paramView)
  {
    switch (paramView.getId())
    {
    default:
      return;
    case 2131493533:
      if (this.subjectMenuOut)
      {
        hiddenSubjectMenu();
        return;
      }
      showSubjectMenu();
      return;
    case 2131493534:
    }
    if (this.bookStoreMenuOut)
    {
      hiddenBookStoreGradeMenu();
      return;
    }
    showBookStoreGradeMenu();
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903207);
    findViews();
    setViews();
  }

  protected void onDestroy()
  {
    BookstoreActivity.cancleAllAsyncTask();
    super.onDestroy();
  }

  protected void onResume()
  {
    super.onResume();
    loadBookSubjectData();
  }

  public void onScroll(AbsListView paramAbsListView, int paramInt1, int paramInt2, int paramInt3)
  {
  }

  public void onScrollStateChanged(AbsListView paramAbsListView, int paramInt)
  {
  }

  public void showConfirmRemoveDialog(BookBean paramBookBean)
  {
    View localView = this.inflater.inflate(2130903050, null);
    ((TextView)localView.findViewById(2131492931)).setText(getResources().getString(2131428195));
    Button localButton1 = (Button)localView.findViewById(2131492933);
    Button localButton2 = (Button)localView.findViewById(2131492934);
    localButton1.setTag(paramBookBean);
    localButton1.setOnClickListener(this.confirmDialogYesOnClickListener);
    localButton2.setOnClickListener(this.confirmDialogNoOnClickListener);
    this.bookConfirmDialog = new Dialog(this, 2131361833);
    this.bookConfirmDialog.addContentView(localView, new LinearLayout.LayoutParams(-2, -2));
    this.bookConfirmDialog.setCanceledOnTouchOutside(true);
    this.bookConfirmDialog.show();
    if ((this.bookDialog != null) && (this.bookDialog.isShowing()))
      this.bookDialog.dismiss();
  }

  public void showExitClickDialog()
  {
    View localView = this.inflater.inflate(2130903050, null);
    ((TextView)localView.findViewById(2131492930)).setText(getString(2131428187));
    ((TextView)localView.findViewById(2131492931)).setText(getResources().getString(2131428199));
    Button localButton1 = (Button)localView.findViewById(2131492933);
    Button localButton2 = (Button)localView.findViewById(2131492934);
    localButton1.setOnClickListener(this.exitConfirmDialogYesOnClickListener);
    localButton2.setOnClickListener(this.exitConfirmDialogNoOnClickListener);
    this.exitConfirmClickDialog = new Dialog(this, 2131361833);
    this.exitConfirmClickDialog.addContentView(localView, new LinearLayout.LayoutParams(-2, -2));
    this.exitConfirmClickDialog.setCanceledOnTouchOutside(true);
    this.exitConfirmClickDialog.show();
  }

  public void showLongClickDialog(BookBean paramBookBean)
  {
    View localView = this.inflater.inflate(2130903051, null);
    ((ImageView)localView.findViewById(2131492935)).setOnClickListener(this.dialogCloseOnClickListener);
    ((TextView)localView.findViewById(2131492930)).setText(paramBookBean.getName());
    Button localButton1 = (Button)localView.findViewById(2131492936);
    Button localButton2 = (Button)localView.findViewById(2131492937);
    localView.findViewById(2131492938).setVisibility(8);
    localButton1.setTag(paramBookBean);
    localButton1.setText(getResources().getString(2131428192));
    localButton1.setOnClickListener(this.dialogViewOnClickListener);
    localButton2.setTag(paramBookBean);
    localButton2.setText(getResources().getString(2131427535));
    localButton2.setOnClickListener(this.dialogRemoveOnClickListener);
    this.bookDialog = new Dialog(this, 2131361833);
    this.bookDialog.addContentView(localView, new LinearLayout.LayoutParams(-2, -2));
    this.bookDialog.setCanceledOnTouchOutside(true);
    this.bookDialog.show();
  }

  class LoadBookListTask extends AsyncTask<String, Integer, String>
  {
    LoadBookListTask()
    {
    }

    protected String doInBackground(String[] paramArrayOfString)
    {
      SyncTutorialActivity.this.listSyncTutorialBookBean = SyncTutorialActivity.this.mDBHelper.getBookBeanListBySubjectId(SyncTutorialActivity.this.currentBookSubjectBean.getSubjectId(), 0);
      return null;
    }

    protected void onPostExecute(String paramString)
    {
      super.onPostExecute(paramString);
      if (SyncTutorialActivity.this.listSyncTutorialBookBean != null);
      while (true)
      {
        if (SyncTutorialActivity.this.listSyncTutorialBookBean.size() >= 5)
        {
          SyncTutorialActivity.this.mTxtHeaderSubject.setText(SyncTutorialActivity.this.currentBookSubjectBean.getName() + "  ");
          if (SyncTutorialActivity.this.mAdapter != null)
          {
            SyncTutorialActivity.this.mAdapter.setData(SyncTutorialActivity.this.listSyncTutorialBookBean);
            SyncTutorialActivity.this.mAdapter.notifyDataSetChanged();
          }
          SyncTutorialActivity.this.closeProgress();
          SyncTutorialActivity.this.hiddenSubjectMenu();
          return;
        }
        SyncTutorialActivity.this.listSyncTutorialBookBean.add(null);
      }
    }
  }

  class LoadBookSubjectTask extends AsyncTask<String, Integer, String>
  {
    LoadBookSubjectTask()
    {
    }

    protected String doInBackground(String[] paramArrayOfString)
    {
      SyncTutorialActivity.this.writeData();
      SyncTutorialActivity.this.initSubjectMenuData();
      return null;
    }

    protected void onPostExecute(String paramString)
    {
      super.onPostExecute(paramString);
      SyncTutorialActivity.this.drawSubjectMenu();
      SyncTutorialActivity.this.mTxtHeaderSubject.setText(SyncTutorialActivity.this.currentBookSubjectBean.getName() + "  ");
      SyncTutorialActivity.this.loadBookListData();
    }

    protected void onPreExecute()
    {
      super.onPreExecute();
      SyncTutorialActivity.this.showProgress("");
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.activity.SyncTutorialActivity
 * JD-Core Version:    0.6.2
 */